package tech.aistar.corejava.day05;

/**
 * @author success
 * @version 1.0
 * @description:本类用来演示:
 * @date 2019/7/19 0019
 */
public class ToStringDemo {
    public static void main(String[] args) {
        Student s = new Student(10,"tom");
        //当我们输出某个对象的时候,会自动去调用该对象的toString()方法-[隐式]
        System.out.println(s);//tech.aistar.corejava.day05.Student@28d93b30
        System.out.println(s.toString());//tech.aistar.corejava.day05.Student@28d93b30

        //toString()底层 -   return this.getClass().getName() + "@" + Integer.toHexString(this.hashCode());

        //s.getClass().getName() - tech.aistar.corejava.day05.Student
        System.out.println(s.getClass().getName()+"@"+Integer.toHexString(s.hashCode()));

        System.out.println("===========================================================");

        String str = new String("hello");
        System.out.println(str);
        //java.lang.String它的父类也是java.lang.Object
        System.out.println(str.toString());
    }
}
